﻿<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>修改手机号码</title>
		<link rel="stylesheet" type="text/css" href="/static/index_user/css/aui_1.css" />
		<link rel="stylesheet" type="text/css" href="/static/index_user/css/aui-slide_1.css" />
		<script type="text/javascript" src="/static/index_user/js/jquery.js"></script>
		<script type="text/javascript">
			function submitt() {

//				var oldmobile = document.loginForm.oldmobile.value;
				var newmobile = document.loginForm.newmobile.value;
				var code = document.loginForm.code.value;

				if(newmobile == null || newmobile == '' || newmobile.length == 0) {
					alert("新手机号码不能为空");
					document.loginForm.newmobile.select();
					return false;
				}

				if(code == null || code == '' || code.length == 0) {
					alert("验证码不能为空");
					document.loginForm.code.select();
					return false;
				}

				document.loginForm.submit();
			}
		</script>
		<script language="javascript">
			function get_mobile_code() {
//				$.post('http://mobile.qiquan.miao9.cc/sms.php', {
//					mobile: jQuery.trim($('#newmobile').val()),
//					send_code: ''
//				}, function(msg) {
//					if(msg == '提交成功') {
//						RemainTime();
//					} else {
//						alert(jQuery.trim(unescape(msg)));
//					}
//				});
				var tel=jQuery.trim($('#newmobile').val());
//                RemainTime();
                $.ajax({
                    type: 'put',
                    url: '/user/SendSMS2/' + tel,
                    dataType: 'json',
                    success: function (data) {
                        if(data['Message']=='OK'){
                            RemainTime();
                        }else{
                            alert(data['Message']);
                        }

                    },
                    error: function () {
                        alert('发生验证码失败');
                    }
                });



			};
			var iTime = 59;
			var Account;

			function RemainTime() {
				document.getElementById('zphone').disabled = true;
				var iSecond, sSecond = "",
					sTime = "";
				if(iTime >= 0) {
					iSecond = parseInt(iTime % 60);
					iMinute = parseInt(iTime / 60)
					if(iSecond >= 0) {
						if(iMinute > 0) {
							sSecond = iMinute + "分" + iSecond + "秒";
						} else {
							sSecond = iSecond + "秒";
						}
					}
					sTime = sSecond;
					if(iTime == 0) {
						clearTimeout(Account);
						sTime = '获取验证码';
						iTime = 59;
						document.getElementById('zphone').disabled = false;
					} else {
						Account = setTimeout("RemainTime()", 1000);
						iTime = iTime - 1;
					}
				} else {
					sTime = '没有倒计时';
				}
				document.getElementById('zphone').value = sTime;
			}
		</script>
		<style type="text/css">
			.aui-list .aui-list-header {
				background-color: #ffffff;
				text-align: center;
				justify-content: center;
				border-bottom: 1px solid #dddddd;
				font-size: 1rem;
			}
			
			.aui-grid [class*=aui-col-] {
				padding: 0.2rem 0;
				text-align: left;
			}
			
			.aui-list label {
				line-height: 1.8rem;
				width: 200px;
			}
		</style>
	</head>

	<body>
		<header class="aui-bar aui-bar-nav" style="position: fixed;">
			<a class="aui-pull-left aui-btn" onclick="javascript:history.back(-1);">
				<span class="aui-iconfont aui-icon-left"></span>
			</a>
			<div class="aui-title">修改手机号码</div>
		</header>
		<form id="loginForm" name="loginForm" action="{:url('user/UserCenter/doedittel')}" method="post" onsubmit="return submitt()">
			<div class="aui-content aui-margin-b-15" style="margin-top: 48px;">
				<ul class="aui-list aui-form-list">

					<li class="aui-list-item">
						<div class="aui-list-item-inner" style="justify-content: right;">
							<div class="aui-list-item-label">
								用户帐号：
							</div>
							<div class="aui-list-item-input">
								{$data.tel}							</div>
						</div>
					</li>

					<!--<li class="aui-list-item">-->
						<!--<div class="aui-list-item-inner" style="justify-content: right;">-->
							<!--<div class="aui-list-item-label">-->
								<!--原手机号码：-->
							<!--</div>-->
							<!--<div class="aui-list-item-input">-->
								<!--<input type="text" name="oldmobile" id="oldmobile" placeholder="请输入原手机号码，如之前没有绑定手机号码，可不填写">-->
							<!--</div>-->
						<!--</div>-->
					<!--</li>-->
					<li class="aui-list-item">
						<div class="aui-list-item-inner" style="justify-content: right;">
							<div class="aui-list-item-label">
								新手机号码：
							</div>
							<div class="aui-list-item-input">
								<input type="text" name="newmobile" id="newmobile" placeholder="请输入新手机号码">
							</div>
						</div>
					</li>
					<li class="aui-list-item">
						<div class="aui-list-item-inner">
							<div class="aui-list-item-label">
								验证码：
							</div>
							<div class="aui-list-item-input">
								<input type="text" name="code" id="code" placeholder="请输入验证码" style="width:60%;float:left"><input type="text" id="zphone" class="input-regist" onClick="get_mobile_code();" placeholder="获取验证码" style="width:40%;float:left">
							</div>
						</div>
					</li>
					<li class="aui-list-item">
						<div class="aui-row" style="width: 100%;">
							<div class="aui-col-xs-12" style="margin-top:10px;margin-bottom:10px;text-align:center">
								<a href="javascript:void(0)" class="btn-login" id="btn-login" onclick="submitt()">
									<div class="aui-btn aui-btn-info" style="width:140px;height:40px;line-height:40px;">修改手机号码</div>
								</a>
							</div>

						</div>

					</li>
				</ul>
			</div>

		</form>

	</body>
	<script type="text/javascript" src="/static/index_user/js/api_1.js"></script>
	<script type="text/javascript" src="/static/index_user/js/aui-tab_1.js"></script>
	<script type="text/javascript" src="/static/index_user/js/aui-slide_1.js"></script>

</html>